﻿@page "/login"
@layout EmptyLayout
@inherits LoginPage

<div class="login">
    <div class="login-head">
        <div class="login-logo">
            <a class="kui-logo" href="@Config.SiteUrl" target="_blank"></a>
            <div class="kui-app-name">@Language[AppConfig.AppName]</div>
        </div>
        <ul class="kui-menu">
            <li><a href="@Config.SiteUrl/doc" target="_blank">@Language[Language.Document]</a></li>
            @if (Config.App.IsLanguage)
            {
                <li style="text-align:center;"><NavLanguage /></li>
            }
            @if (Config.App.IsTheme)
            {
                <li style="margin-left:15px;"><NavTheme /></li>
            }
        </ul>
    </div>
    <div class="login-body">
        <div class="login-left">
            <ul>
                <li>@Language[Language.OpenSource]</li>
                <li>@Language[Language.LowCode]</li>
                <li>@Language[Language.ModernUI]</li>
            </ul>
            <img src="img/login.png" />
        </div>
        <div class="login-form">
            <div class="login-form-body">
                <Tabs Animated>
                    <TabPane Key="Account" Tab="@Language[Language.LoginWithAccount]">
                        <LoginForm Model="Model" OnLogin="OnUserLogin" IsCaptcha="IsCaptcha" />
                    </TabPane>
                    <TabPane Key="Phone" Tab="@Language[Language.LoginWithPhone]">
                        <LoginForm Model="Model" OnLogin="OnUserLogin" OnSendSMS="OnSendSMS" />
                    </TabPane>
                </Tabs>
            </div>
        </div>
    </div>
    <div class="login-copyright"><KFooter /></div>
</div>

@code {
    private bool IsCaptcha => false;

    protected override Task OnInitAsync()
    {
        Model.UserName = "Admin";
        Model.Password = "1";
        return base.OnInitAsync();
    }

    private Task<Known.Result> OnSendSMS(string phone)
    {
        return Known.Result.SuccessAsync("发送成功！");
    }
}